package threadDemo;

/**
 * 测试join方法  // 想象为插队
 */
public class Test10 implements Runnable{
    public static void main(String[] args) {
        Test10 t = new Test10();
        Thread thread = new Thread(t);
        thread.start();
        for (int i = 0; i < 100; i++) {
            if(i==50){
                try {
                    thread.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("主线程 ："+i);
        }
    }

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("线程vip "+i);
        }
    }
}
